/**
 * aes加密
 */
(function ($) {
    $.extend({
        use: {
            /**
             * 加密
             * @param word
             * @returns {string}
             */
            encrypt: function (word) {
                var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
                var srcs = CryptoJS.enc.Utf8.parse(word);
                var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
                return encrypted.toString();
            },

            /**
             * 解密
             * @param word
             * @returns {string}
             */
            decrypt: function (word) {
                var key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
                var decrypt = CryptoJS.AES.decrypt(word, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
                return CryptoJS.enc.Utf8.stringify(decrypt).toString();
            },
            amount: function (id,url){
                $.get(url,function (result) {
                    $("#"+id).text($.use.decrypt(result));
                });
            }

        }

    });
})(jQuery);